package com.atguigu.prototype.deepclone;

public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        DeepProtoType deepProtoType1 = new DeepProtoType();
        deepProtoType1.setName("111");
        deepProtoType1.setDeepCloneableTarget(new DeepCloneableTarget("222", "333"));

//        DeepProtoType deepProtoType2 = (DeepProtoType) deepProtoType1.clone();
//
//        System.out.println(deepProtoType1 == deepProtoType2);
//        System.out.println(deepProtoType1.equals(deepProtoType2));
//
//        System.out.println();
//
//        System.out.println(deepProtoType1.getDeepCloneableTarget() == deepProtoType2.getDeepCloneableTarget());
//        System.out.println(deepProtoType1.getDeepCloneableTarget().equals(deepProtoType2.getDeepCloneableTarget()));
//        System.out.println(deepProtoType1.getDeepCloneableTarget().hashCode());
//        System.out.println(deepProtoType2.getDeepCloneableTarget().hashCode());

        DeepProtoType deepProtoType2 = (DeepProtoType) deepProtoType1.deepClone();

        System.out.println(deepProtoType1 == deepProtoType2);
        System.out.println(deepProtoType1.equals(deepProtoType2));

        System.out.println();

        System.out.println(deepProtoType1.getDeepCloneableTarget() == deepProtoType2.getDeepCloneableTarget());
        System.out.println(deepProtoType1.getDeepCloneableTarget().equals(deepProtoType2.getDeepCloneableTarget()));
        System.out.println(deepProtoType1.getDeepCloneableTarget().hashCode());
        System.out.println(deepProtoType2.getDeepCloneableTarget().hashCode());
    }
}
